#ifndef QPOINTCHOOSER_H
#define QPOINTCHOOSER_H

#include <QtGui/QWidget>
#include <QtGui/QPaintEvent>
#include <QtGui/QMouseEvent>
#include <QtGui/QResizeEvent>

class QPointChooser : public QWidget
{
    Q_OBJECT

    Q_PROPERTY(int BoardWidth READ bWidth WRITE setBWidth)
    Q_PROPERTY(int BoardHeight READ bHeight WRITE setBHeight)
    
public:
    QPointChooser(QWidget *parent = 0);
    void paintEvent(QPaintEvent *);
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
    int bWidth() const;
    int bHeight() const;
    QSize sizeHint() const;

signals:
    void pointChoosed(float, float);

public slots:
    void setBWidth(int);
    void setBHeight(int);

private:
    int maxW, maxH, xClick, yClick;
    void perform(QMouseEvent *);
    void calculate();
};

#endif
